package com.ngmaster.socket.message;

import com.ngmaster.socket.ProtocolMessage;

import java.util.Arrays;

/**
 * 修改域名和端口
 * 暂时不用
 */
public class ModifyHostPortMessage extends ProtocolMessage {

    private String host;

    private int port;

    @Override
    public void onSerial() {
        this.byteArray.writeString(this.host);
        this.byteArray.writeInt(this.port);
    }

    @Override
    public void onDeserialize() {
        this.host = this.byteArray.readString();
        this.port = this.byteArray.readInt();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("ModifyHostPortMessage{");
        sb.append("host='").append(host).append('\'');
        sb.append(", port=").append(port);
        sb.append(", imeiBytes=").append(Arrays.toString(imeiBytes));
        sb.append(", imei='").append(imei).append('\'');
        sb.append(", cmd=").append(cmd);
        sb.append(", dataLength=").append(dataLength);
        sb.append(", crc=").append(crc);
        sb.append(", crcHex='").append(crcHex).append('\'');
        sb.append(", byteArray=").append(byteArray);
        sb.append('}');
        return sb.toString();
    }
}
